import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/views/Home'
import Login from '@/views/Login'
import Temp from '@/views/Temp'
import UserHome from '@/views/UserCenter/Home'
import UserLayout from '@/views/UserLayout'
import Register from '@/views/Register'
import UserInfo from '@/views/UserCenter/UserInfo'
import UserAddress from '@/views/UserCenter/UserAddress'
import AddUserAddress from '@/views/UserCenter/AddUserAddress'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/temp',
      name: 'Temp',
      component: Temp
    },
    {
      path: '/register',
      name: 'Register',
      component: Register
    },
    {
      path: '/user',
      name: 'UserFrame',
      component: UserLayout,
      children: [
        {
          path: '/user/',
          component: UserHome
        },
        {
          path: '/user/info',
          component: UserInfo
        },
        {
          name: 'addressList',
          path: '/user/address',
          component: UserAddress,
          children: [
            {
              name: 'addressAdd',
              path: '/user/address/add',
              component: AddUserAddress
            },
            {
              name: 'addressEdit',
              path: '/user/address/edit',
              component: AddUserAddress
            }
          ]
        }
      ]
    }
  ]
})
